home *** CD-ROM | disk | FTP | other *** search
/ Digitalfoto 118 / Digitalfoto 118.iso / mac / galeriamx(2).swf / scripts / __Packages / mx / core / UIObject.as < prev    next >
Text File  |  2007-09-27  |  15KB  |  599 lines

  1. class mx.core.UIObject extends MovieClip
  2. {
  3.    static var symbolName = "UIObject";
  4.    static var symbolOwner = mx.core.UIObject;
  5.    static var version = "2.0.2.126";
  6.    static var textColorList = {color:1,disabledColor:1};
  7.    var invalidateFlag = false;
  8.    var lineWidth = 1;
  9.    var lineColor = 0;
  10.    var tabEnabled = false;
  11.    var clipParameters = {visible:1,minHeight:1,minWidth:1,maxHeight:1,maxWidth:1,preferredHeight:1,preferredWidth:1};
  12.    function UIObject()
  13.    {
  14.       super();
  15.       this.constructObject();
  16.    }
  17.    function get width()
  18.    {
  19.       return this._width;
  20.    }
  21.    function get height()
  22.    {
  23.       return this._height;
  24.    }
  25.    function get left()
  26.    {
  27.       return this._x;
  28.    }
  29.    function get x()
  30.    {
  31.       return this._x;
  32.    }
  33.    function get top()
  34.    {
  35.       return this._y;
  36.    }
  37.    function get y()
  38.    {
  39.       return this._y;
  40.    }
  41.    function get right()
  42.    {
  43.       return this._parent.width - (this._x + this.__get__width());
  44.    }
  45.    function get bottom()
  46.    {
  47.       return this._parent.height - (this._y + this.__get__height());
  48.    }
  49.    function getMinHeight(Void)
  50.    {
  51.       return this._minHeight;
  52.    }
  53.    function setMinHeight(h)
  54.    {
  55.       this._minHeight = h;
  56.    }
  57.    function get minHeight()
  58.    {
  59.       return this.getMinHeight();
  60.    }
  61.    function set minHeight(h)
  62.    {
  63.       this.setMinHeight(h);
  64.    }
  65.    function getMinWidth(Void)
  66.    {
  67.       return this._minWidth;
  68.    }
  69.    function setMinWidth(w)
  70.    {
  71.       this._minWidth = w;
  72.    }
  73.    function get minWidth()
  74.    {
  75.       return this.getMinWidth();
  76.    }
  77.    function set minWidth(w)
  78.    {
  79.       this.setMinWidth(w);
  80.    }
  81.    function setVisible(x, noEvent)
  82.    {
  83.       if(x != this._visible)
  84.       {
  85.          this._visible = x;
  86.          if(noEvent != true)
  87.          {
  88.             this.dispatchEvent({type:(!x ? "hide" : "reveal")});
  89.          }
  90.       }
  91.    }
  92.    function get visible()
  93.    {
  94.       return this._visible;
  95.    }
  96.    function set visible(x)
  97.    {
  98.       this.setVisible(x,false);
  99.    }
  100.    function get scaleX()
  101.    {
  102.       return this._xscale;
  103.    }
  104.    function set scaleX(x)
  105.    {
  106.       this._xscale = x;
  107.    }
  108.    function get scaleY()
  109.    {
  110.       return this._yscale;
  111.    }
  112.    function set scaleY(y)
  113.    {
  114.       this._yscale = y;
  115.    }
  116.    function doLater(obj, fn)
  117.    {
  118.       if(this.methodTable == undefined)
  119.       {
  120.          this.methodTable = new Array();
  121.       }
  122.       this.methodTable.push({obj:obj,fn:fn});
  123.       this.onEnterFrame = this.doLaterDispatcher;
  124.    }
  125.    function doLaterDispatcher(Void)
  126.    {
  127.       delete this.onEnterFrame;
  128.       if(this.invalidateFlag)
  129.       {
  130.          this.redraw();
  131.       }
  132.       var _loc3_ = this.methodTable;
  133.       this.methodTable = new Array();
  134.       if(_loc3_.length > 0)
  135.       {
  136.          var _loc2_ = undefined;
  137.          while((_loc2_ = _loc3_.shift()) != undefined)
  138.          {
  139.             _loc2_.obj[_loc2_.fn]();
  140.          }
  141.       }
  142.    }
  143.    function cancelAllDoLaters(Void)
  144.    {
  145.       delete this.onEnterFrame;
  146.       this.methodTable = new Array();
  147.    }
  148.    function invalidate(Void)
  149.    {
  150.       this.invalidateFlag = true;
  151.       this.onEnterFrame = this.doLaterDispatcher;
  152.    }
  153.    function invalidateStyle(Void)
  154.    {
  155.       this.invalidate();
  156.    }
  157.    function redraw(bAlways)
  158.    {
  159.       if(this.invalidateFlag || bAlways)
  160.       {
  161.          this.invalidateFlag = false;
  162.          var _loc2_ = undefined;
  163.          for(_loc2_ in this.tfList)
  164.          {
  165.             this.tfList[_loc2_].draw();
  166.          }
  167.          this.draw();
  168.          this.dispatchEvent({type:"draw"});
  169.       }
  170.    }
  171.    function draw(Void)
  172.    {
  173.    }
  174.    function move(x, y, noEvent)
  175.    {
  176.       var _loc3_ = this._x;
  177.       var _loc2_ = this._y;
  178.       this._x = x;
  179.       this._y = y;
  180.       if(noEvent != true)
  181.       {
  182.          this.dispatchEvent({type:"move",oldX:_loc3_,oldY:_loc2_});
  183.       }
  184.    }
  185.    function setSize(w, h, noEvent)
  186.    {
  187.       var _loc2_ = this.__width;
  188.       var _loc3_ = this.__height;
  189.       this.__width = w;
  190.       this.__height = h;
  191.       this.size();
  192.       if(noEvent != true)
  193.       {
  194.          this.dispatchEvent({type:"resize",oldWidth:_loc2_,oldHeight:_loc3_});
  195.       }
  196.    }
  197.    function size(Void)
  198.    {
  199.       this._width = this.__width;
  200.       this._height = this.__height;
  201.    }
  202.    function drawRect(x1, y1, x2, y2)
  203.    {
  204.       this.moveTo(x1,y1);
  205.       this.lineTo(x2,y1);
  206.       this.lineTo(x2,y2);
  207.       this.lineTo(x1,y2);
  208.       this.lineTo(x1,y1);
  209.    }
  210.    function createLabel(name, depth, text)
  211.    {
  212.       this.createTextField(name,depth,0,0,0,0);
  213.       var _loc2_ = this[name];
  214.       _loc2_._color = mx.core.UIObject.textColorList;
  215.       _loc2_._visible = false;
  216.       _loc2_.__text = text;
  217.       if(this.tfList == undefined)
  218.       {
  219.          this.tfList = new Object();
  220.       }
  221.       this.tfList[name] = _loc2_;
  222.       _loc2_.invalidateStyle();
  223.       this.invalidate();
  224.       _loc2_.styleName = this;
  225.       return _loc2_;
  226.    }
  227.    function createObject(linkageName, id, depth, initobj)
  228.    {
  229.       return this.attachMovie(linkageName,id,depth,initobj);
  230.    }
  231.    function createClassObject(className, id, depth, initobj)
  232.    {
  233.       var _loc3_ = className.symbolName == undefined;
  234.       if(_loc3_)
  235.       {
  236.          Object.registerClass(className.symbolOwner.symbolName,className);
  237.       }
  238.       var _loc4_ = this.createObject(className.symbolOwner.symbolName,id,depth,initobj);
  239.       if(_loc3_)
  240.       {
  241.          Object.registerClass(className.symbolOwner.symbolName,className.symbolOwner);
  242.       }
  243.       return _loc4_;
  244.    }
  245.    function createEmptyObject(id, depth)
  246.    {
  247.       return this.createClassObject(mx.core.UIObject,id,depth);
  248.    }
  249.    function destroyObject(id)
  250.    {
  251.       var _loc2_ = this[id];
  252.       if(_loc2_.getDepth() < 0)
  253.       {
  254.          var _loc4_ = this.buildDepthTable();
  255.          var _loc5_ = this.findNextAvailableDepth(0,_loc4_,"up");
  256.          var _loc3_ = _loc5_;
  257.          _loc2_.swapDepths(_loc3_);
  258.       }
  259.       _loc2_.removeMovieClip();
  260.       delete this[id];
  261.    }
  262.    function getSkinIDName(tag)
  263.    {
  264.       return this.idNames[tag];
  265.    }
  266.    function setSkin(tag, linkageName, initObj)
  267.    {
  268.       if(_global.skinRegistry[linkageName] == undefined)
  269.       {
  270.          mx.skins.SkinElement.registerElement(linkageName,mx.skins.SkinElement);
  271.       }
  272.       return this.createObject(linkageName,this.getSkinIDName(tag),tag,initObj);
  273.    }
  274.    function createSkin(tag)
  275.    {
  276.       var _loc2_ = this.getSkinIDName(tag);
  277.       this.createEmptyObject(_loc2_,tag);
  278.       return this[_loc2_];
  279.    }
  280.    function createChildren(Void)
  281.    {
  282.    }
  283.    function _createChildren(Void)
  284.    {
  285.       this.createChildren();
  286.       this.childrenCreated = true;
  287.    }
  288.    function constructObject(Void)
  289.    {
  290.       if(this._name == undefined)
  291.       {
  292.          return undefined;
  293.       }
  294.       this.init();
  295.       this._createChildren();
  296.       this.createAccessibilityImplementation();
  297.       this._endInit();
  298.       if(this.validateNow)
  299.       {
  300.          this.redraw(true);
  301.       }
  302.       else
  303.       {
  304.          this.invalidate();
  305.       }
  306.    }
  307.    function initFromClipParameters(Void)
  308.    {
  309.       var _loc4_ = false;
  310.       var _loc2_ = undefined;
  311.       for(_loc2_ in this.clipParameters)
  312.       {
  313.          if(this.hasOwnProperty(_loc2_))
  314.          {
  315.             _loc4_ = true;
  316.             this["def_" + _loc2_] = this[_loc2_];
  317.             delete this[_loc2_];
  318.          }
  319.       }
  320.       if(_loc4_)
  321.       {
  322.          for(_loc2_ in this.clipParameters)
  323.          {
  324.             var _loc3_ = this["def_" + _loc2_];
  325.             if(_loc3_ != undefined)
  326.             {
  327.                this[_loc2_] = _loc3_;
  328.             }
  329.          }
  330.       }
  331.    }
  332.    function init(Void)
  333.    {
  334.       this.__width = this._width;
  335.       this.__height = this._height;
  336.       if(this.initProperties == undefined)
  337.       {
  338.          this.initFromClipParameters();
  339.       }
  340.       else
  341.       {
  342.          this.initProperties();
  343.       }
  344.       if(_global.cascadingStyles == true)
  345.       {
  346.          this.stylecache = new Object();
  347.       }
  348.    }
  349.    function getClassStyleDeclaration(Void)
  350.    {
  351.       var _loc4_ = this;
  352.       var _loc3_ = this.className;
  353.       while(_loc3_ != undefined)
  354.       {
  355.          if(this.ignoreClassStyleDeclaration[_loc3_] == undefined)
  356.          {
  357.             if(_global.styles[_loc3_] != undefined)
  358.             {
  359.                return _global.styles[_loc3_];
  360.             }
  361.          }
  362.          _loc4_ = _loc4_.__proto__;
  363.          _loc3_ = _loc4_.className;
  364.       }
  365.    }
  366.    function setColor(color)
  367.    {
  368.    }
  369.    function __getTextFormat(tf, bAll)
  370.    {
  371.       var _loc8_ = this.stylecache.tf;
  372.       if(_loc8_ != undefined)
  373.       {
  374.          var _loc3_ = undefined;
  375.          for(_loc3_ in mx.styles.StyleManager.TextFormatStyleProps)
  376.          {
  377.             if(bAll || mx.styles.StyleManager.TextFormatStyleProps[_loc3_])
  378.             {
  379.                if(tf[_loc3_] == undefined)
  380.                {
  381.                   tf[_loc3_] = _loc8_[_loc3_];
  382.                }
  383.             }
  384.          }
  385.          return false;
  386.       }
  387.       var _loc6_ = false;
  388.       for(_loc3_ in mx.styles.StyleManager.TextFormatStyleProps)
  389.       {
  390.          if(bAll || mx.styles.StyleManager.TextFormatStyleProps[_loc3_])
  391.          {
  392.             if(tf[_loc3_] == undefined)
  393.             {
  394.                var _loc5_ = this._tf[_loc3_];
  395.                if(_loc5_ != undefined)
  396.                {
  397.                   tf[_loc3_] = _loc5_;
  398.                }
  399.                else if(_loc3_ == "font" && this.fontFamily != undefined)
  400.                {
  401.                   tf[_loc3_] = this.fontFamily;
  402.                }
  403.                else if(_loc3_ == "size" && this.fontSize != undefined)
  404.                {
  405.                   tf[_loc3_] = this.fontSize;
  406.                }
  407.                else if(_loc3_ == "color" && this.color != undefined)
  408.                {
  409.                   tf[_loc3_] = this.color;
  410.                }
  411.                else if(_loc3_ == "leftMargin" && this.marginLeft != undefined)
  412.                {
  413.                   tf[_loc3_] = this.marginLeft;
  414.                }
  415.                else if(_loc3_ == "rightMargin" && this.marginRight != undefined)
  416.                {
  417.                   tf[_loc3_] = this.marginRight;
  418.                }
  419.                else if(_loc3_ == "italic" && this.fontStyle != undefined)
  420.                {
  421.                   tf[_loc3_] = this.fontStyle == _loc3_;
  422.                }
  423.                else if(_loc3_ == "bold" && this.fontWeight != undefined)
  424.                {
  425.                   tf[_loc3_] = this.fontWeight == _loc3_;
  426.                }
  427.                else if(_loc3_ == "align" && this.textAlign != undefined)
  428.                {
  429.                   tf[_loc3_] = this.textAlign;
  430.                }
  431.                else if(_loc3_ == "indent" && this.textIndent != undefined)
  432.                {
  433.                   tf[_loc3_] = this.textIndent;
  434.                }
  435.                else if(_loc3_ == "underline" && this.textDecoration != undefined)
  436.                {
  437.                   tf[_loc3_] = this.textDecoration == _loc3_;
  438.                }
  439.                else if(_loc3_ == "embedFonts" && this.embedFonts != undefined)
  440.                {
  441.                   tf[_loc3_] = this.embedFonts;
  442.                }
  443.                else
  444.                {
  445.                   _loc6_ = true;
  446.                }
  447.             }
  448.          }
  449.       }
  450.       if(_loc6_)
  451.       {
  452.          var _loc9_ = this.styleName;
  453.          if(_loc9_ != undefined)
  454.          {
  455.             if(typeof _loc9_ != "string")
  456.             {
  457.                _loc6_ = _loc9_.__getTextFormat(tf,true,this);
  458.             }
  459.             else if(_global.styles[_loc9_] != undefined)
  460.             {
  461.                _loc6_ = _global.styles[_loc9_].__getTextFormat(tf,true,this);
  462.             }
  463.          }
  464.       }
  465.       if(_loc6_)
  466.       {
  467.          var _loc10_ = this.getClassStyleDeclaration();
  468.          if(_loc10_ != undefined)
  469.          {
  470.             _loc6_ = _loc10_.__getTextFormat(tf,true,this);
  471.          }
  472.       }
  473.       if(_loc6_)
  474.       {
  475.          if(_global.cascadingStyles)
  476.          {
  477.             if(this._parent != undefined)
  478.             {
  479.                _loc6_ = this._parent.__getTextFormat(tf,false);
  480.             }
  481.          }
  482.       }
  483.       if(_loc6_)
  484.       {
  485.          _loc6_ = _global.style.__getTextFormat(tf,true,this);
  486.       }
  487.       return _loc6_;
  488.    }
  489.    function _getTextFormat(Void)
  490.    {
  491.       var _loc2_ = this.stylecache.tf;
  492.       if(_loc2_ != undefined)
  493.       {
  494.          return _loc2_;
  495.       }
  496.       _loc2_ = new TextFormat();
  497.       this.__getTextFormat(_loc2_,true);
  498.       this.stylecache.tf = _loc2_;
  499.       if(this.enabled == false)
  500.       {
  501.          var _loc3_ = this.getStyle("disabledColor");
  502.          _loc2_.color = _loc3_;
  503.       }
  504.       return _loc2_;
  505.    }
  506.    function getStyleName(Void)
  507.    {
  508.       var _loc2_ = this.styleName;
  509.       if(_loc2_ != undefined)
  510.       {
  511.          if(typeof _loc2_ != "string")
  512.          {
  513.             return _loc2_.getStyleName();
  514.          }
  515.          return _loc2_;
  516.       }
  517.       if(this._parent != undefined)
  518.       {
  519.          return this._parent.getStyleName();
  520.       }
  521.       return undefined;
  522.    }
  523.    function getStyle(styleProp)
  524.    {
  525.       var _loc3_ = undefined;
  526.       _global.getStyleCounter = _global.getStyleCounter + 1;
  527.       if(this[styleProp] != undefined)
  528.       {
  529.          return this[styleProp];
  530.       }
  531.       var _loc6_ = this.styleName;
  532.       if(_loc6_ != undefined)
  533.       {
  534.          if(typeof _loc6_ != "string")
  535.          {
  536.             _loc3_ = _loc6_.getStyle(styleProp);
  537.          }
  538.          else
  539.          {
  540.             var _loc7_ = _global.styles[_loc6_];
  541.             _loc3_ = _loc7_.getStyle(styleProp);
  542.          }
  543.       }
  544.       if(_loc3_ != undefined)
  545.       {
  546.          return _loc3_;
  547.       }
  548.       _loc7_ = this.getClassStyleDeclaration();
  549.       if(_loc7_ != undefined)
  550.       {
  551.          _loc3_ = _loc7_[styleProp];
  552.       }
  553.       if(_loc3_ != undefined)
  554.       {
  555.          return _loc3_;
  556.       }
  557.       if(_global.cascadingStyles)
  558.       {
  559.          if(mx.styles.StyleManager.isInheritingStyle(styleProp) || mx.styles.StyleManager.isColorStyle(styleProp))
  560.          {
  561.             var _loc5_ = this.stylecache;
  562.             if(_loc5_ != undefined)
  563.             {
  564.                if(_loc5_[styleProp] != undefined)
  565.                {
  566.                   return _loc5_[styleProp];
  567.                }
  568.             }
  569.             if(this._parent != undefined)
  570.             {
  571.                _loc3_ = this._parent.getStyle(styleProp);
  572.             }
  573.             else
  574.             {
  575.                _loc3_ = _global.style[styleProp];
  576.             }
  577.             if(_loc5_ != undefined)
  578.             {
  579.                _loc5_[styleProp] = _loc3_;
  580.             }
  581.             return _loc3_;
  582.          }
  583.       }
  584.       if(_loc3_ == undefined)
  585.       {
  586.          _loc3_ = _global.style[styleProp];
  587.       }
  588.       return _loc3_;
  589.    }
  590.    static function mergeClipParameters(o, p)
  591.    {
  592.       for(var _loc3_ in p)
  593.       {
  594.          o[_loc3_] = p[_loc3_];
  595.       }
  596.       return true;
  597.    }
  598. }
  599.